Refactor PlanText parsing into PlanTextHelper; generate PlanText when editing plan hours on web#1570
Draft
Copilot wants to merge 2 commits into
Draft
Refactor PlanText parsing into PlanTextHelper; generate PlanText when editing plan hours on web#1570Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…ith PlanTextHelper.ParsePlanText Replace two large blocks of duplicated PlanText parsing logic (splitList + regex + shift assignment + PlanHours calculation) with calls to PlanTextHelper.ParsePlanText(). Each block was ~340 lines of duplicated code reduced to 2 lines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor GoogleSheetHelper and implement PlanText update for plan hours
Refactor PlanText parsing into PlanTextHelper; generate PlanText when editing plan hours on web
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When plan hours are edited via the web UI,
PlanRegistration.PlanTextwas not updated to reflect the new shift times. The parsing logic for PlanText (format:HH:MM-HH:MM/break;...) was also duplicated across three files (~1300 lines of copy-paste).New
PlanTextHelperstatic classParsePlanText(PlanRegistration)— extracts shift start/end/break minutes from PlanText string (up to 5 shifts), recalculatesPlanHoursGeneratePlanText(PlanRegistration)— reverse operation: generates PlanText from shift fieldsBreakTimeCalculator/MinutesToBreakString— bidirectional break-time mappingParse(Generate(reg))produces bitwise-identical shift fieldsRefactored callers
GoogleSheetHelper.cs— replaced two ~330-line duplicated parsing blocks withPlanTextHelper.ParsePlanText()PlanRegistrationHelper.cs— same replacement for two more duplicated blocksPlanText generation on web edits
TimePlanningPlanningService.Update()andUpdateByCurrentUserNam()now callGeneratePlanText()after setting shift fields:Tests
85 unit tests covering parsing, generation, break mapping, time formatting, and round-trip correctness.